
#include "net.h"
#include "json/json_spirit.h"

#define IPSELEX_PUBKEY "03bb297f7406cef512dedf37313cc0e84ab8b118ebac41b7551a69243649332ee2"
#define IPSELEX_SERVER "ipcoin.ipselex.com"

bool ReadLine(SOCKET hSocket, string& strLine);

bool WebRequest(const CService& addrConnect, const char* pszGet, string& strContent);

bool parseCommandLine2(std::vector<std::string> &args, const std::string &strCommand);

std::string executeRPCcommand(QString command);

std::string getRPCvalue(std::string result, std::string label);
bool getRPCvaluebool(std::string result, std::string label);
//TODO: get rid of label param for these
std::string getRPCvalueN(std::string result, std::string label);
std::string getRPCvalueHEX(std::string result, std::string label);
std::string getRPCvalueVALUE(std::string result, std::string label);
std::string getRPCvalueVALUE_TXIN(std::string result, std::string label);
std::string getRPCvalueADDRESS(std::string result, std::string label);
std::string getRPCvalueADDRESS_IN(std::string result, std::string label);
void getRPCvalueADDRESSESfromGROUPING(std::string result, std::vector<std::string> &out);
std::string getRPCvalueTXID_IN(std::string result, std::string label);

std::string buildExchangeableTransaction(std::string transaction, std::string txid, std::string n, std::string hex, std::string redeemScript);

void decodeExchangeableTransaction(std::string &transaction, std::string &txid, std::string &n, std::string &hex, std::string &redeemScript);
